export interface DbStorage {
  setItem<T>(key: string, value: T): void;

  getItem<T>(key: string): T | null;

  removeItem(key: string): void;
}


export interface DbAsyncReturn {
  id: string,
  rev?: string,
  ok?: boolean,
  error?: boolean,
  name?: string,
  message?: string
}

export type DbAsyncDoc<T extends {} = Record<string, any>> = {
  _id: string,
  _rev?: string,
} & T

export interface DbAsyncStorage {
  /**
   * 创建/更新文档
   */
  put(doc: DbAsyncDoc): Promise<DbAsyncReturn>;

  /**
   * 获取文档
   */
  get(id: string): Promise<DbAsyncDoc | undefined | null>;

  /**
   * 删除文档
   */
  remove(doc: string | DbAsyncDoc): Promise<DbAsyncReturn>;
}

export interface Application {
  copyText: (text: string) => void;
  shellOpenExternal: (url: string) => void;
}